home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / lib / include / RCS / proc.h,v < prev    next >
Encoding:
Text File  |  1992-05-31  |  28.0 KB  |  1,127 lines

  1. head     1.22;
  2. branch   ;
  3. access   ;
  4. symbols  sprited:1.18.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.22
  10. date     92.05.31.16.54.40;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.21;
  13.  
  14. 1.21
  15. date     92.01.06.14.51.01;  author kupfer;  state Exp;
  16. branches ;
  17. next     1.20;
  18.  
  19. 1.20
  20. date     91.08.24.13.05.37;  author mottsmth;  state Exp;
  21. branches ;
  22. next     1.19;
  23.  
  24. 1.19
  25. date     91.08.20.13.03.20;  author mottsmth;  state Exp;
  26. branches ;
  27. next     1.18;
  28.  
  29. 1.18
  30. date     91.05.17.17.30.23;  author kupfer;  state Exp;
  31. branches 1.18.1.1;
  32. next     1.17;
  33.  
  34. 1.17
  35. date     91.03.17.23.28.09;  author kupfer;  state Exp;
  36. branches ;
  37. next     1.16;
  38.  
  39. 1.16
  40. date     91.03.01.22.11.03;  author kupfer;  state Exp;
  41. branches ;
  42. next     1.15;
  43.  
  44. 1.15
  45. date     90.11.14.13.23.55;  author shirriff;  state Exp;
  46. branches ;
  47. next     1.14;
  48.  
  49. 1.14
  50. date     90.10.19.15.50.38;  author jhh;  state Exp;
  51. branches ;
  52. next     1.13;
  53.  
  54. 1.13
  55. date     90.06.21.13.56.30;  author shirriff;  state Exp;
  56. branches ;
  57. next     1.12;
  58.  
  59. 1.12
  60. date     89.10.12.12.14.40;  author jhh;  state Exp;
  61. branches ;
  62. next     1.11;
  63.  
  64. 1.11
  65. date     89.10.10.16.04.02;  author douglis;  state Exp;
  66. branches ;
  67. next     1.10;
  68.  
  69. 1.10
  70. date     89.09.08.16.27.22;  author mgbaker;  state Exp;
  71. branches ;
  72. next     1.9;
  73.  
  74. 1.9
  75. date     89.08.08.11.09.30;  author douglis;  state Exp;
  76. branches ;
  77. next     1.8;
  78.  
  79. 1.8
  80. date     89.07.05.21.09.35;  author rab;  state Exp;
  81. branches ;
  82. next     1.7;
  83.  
  84. 1.7
  85. date     89.06.23.11.29.53;  author rab;  state Exp;
  86. branches ;
  87. next     1.6;
  88.  
  89. 1.6
  90. date     89.06.15.22.34.13;  author douglis;  state Exp;
  91. branches ;
  92. next     1.5;
  93.  
  94. 1.5
  95. date     89.04.07.10.31.25;  author douglis;  state Exp;
  96. branches ;
  97. next     1.4;
  98.  
  99. 1.4
  100. date     89.03.27.22.26.01;  author jhh;  state Exp;
  101. branches ;
  102. next     1.3;
  103.  
  104. 1.3
  105. date     88.08.25.12.24.17;  author nelson;  state Exp;
  106. branches ;
  107. next     1.2;
  108.  
  109. 1.2
  110. date     88.06.21.16.38.32;  author ouster;  state Exp;
  111. branches ;
  112. next     1.1;
  113.  
  114. 1.1
  115. date     88.06.21.09.36.54;  author ouster;  state Exp;
  116. branches ;
  117. next     ;
  118.  
  119. 1.18.1.1
  120. date     91.08.05.17.29.56;  author kupfer;  state Exp;
  121. branches ;
  122. next     ;
  123.  
  124.  
  125. desc
  126. @@
  127.  
  128.  
  129. 1.22
  130. log
  131. @Fix up comments for PROC_MIGRATING and PROC_MIGRATION_DONE.
  132. @
  133. text
  134. @/*
  135.  * procUser.h --
  136.  *
  137.  *    Definitions for use in the Proc system calls.
  138.  *
  139.  * Copyright 1986, 1988 Regents of the University of California
  140.  * Permission to use, copy, modify, and distribute this
  141.  * software and its documentation for any purpose and without
  142.  * fee is hereby granted, provided that the above copyright
  143.  * notice appear in all copies.  The University of California
  144.  * makes no representations about the suitability of this
  145.  * software for any purpose.  It is provided "as is" without
  146.  * express or implied warranty.
  147.  *
  148.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.21 92/01/06 14:51:01 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  149.  */
  150.  
  151. #ifndef _PROCUSER
  152. #define _PROCUSER
  153.  
  154.  
  155. /*
  156.  * Process Termination Reason flags:
  157.  *
  158.  *   PROC_TERM_EXITED        - The process has called Proc_Exit.
  159.  *   PROC_TERM_DETACHED        - The process has called Proc_Detach.
  160.  *   PROC_TERM_SIGNALED        - The process has died because of a signal.
  161.  *   PROC_TERM_DESTROYED    - The process has died because the internal
  162.  *                  state of the process was found to be
  163.  *                  invalid as a result of a user level error.
  164.  *   PROC_TERM_SUSPENDED    - The process has been suspended.
  165.  *   PROC_TERM_RESUMED        - The process has resumed execution as the
  166.  *                  result of a resume signal.
  167.  */
  168.  
  169. #define PROC_TERM_EXITED        1
  170. #define PROC_TERM_DETACHED        2
  171. #define PROC_TERM_SIGNALED        3
  172. #define PROC_TERM_DESTROYED        4
  173. #define    PROC_TERM_SUSPENDED        5
  174. #define    PROC_TERM_RESUMED        6
  175.  
  176. /*
  177.  * Reasons why a process was destroyed (PROC_TERM_DESTROYED):
  178.  * 
  179.  * PROC_BAD_STACK        - A process's user stack is invalid upon
  180.  *                  return from a signal handler.
  181.  * PROC_BAD_PSW         - The processor status word that is to be
  182.  *                  restored upon return from a signal handler
  183.  *                  has the supervisor bit set.
  184.  * PROC_VM_READ_ERROR        - The virtual memory system couldn't read from
  185.  *                  the page server.
  186.  * PROC_VM_WRITE_ERROR        - The virtual memory system couldn't write to
  187.  *                  the page server.
  188.  */
  189.  
  190. #define    PROC_BAD_STACK            1
  191. #define    PROC_BAD_PSW            2
  192. #define    PROC_VM_READ_ERROR        3
  193. #define    PROC_VM_WRITE_ERROR        4
  194.  
  195. #ifndef _ASM
  196. /*
  197.  *  Definition of a process ID.
  198.  */
  199.  
  200. typedef unsigned int     Proc_PID;
  201.  
  202.  
  203.  
  204. /*
  205.  * Special values to indicate the pid of the current process, or the host on
  206.  * which it is running, respectively.
  207.  */
  208.  
  209. #define PROC_MY_PID    ((Proc_PID) 0xffffffff)
  210. #define PROC_MY_HOSTID    ((unsigned int) 0xffffffff)
  211.  
  212. /*
  213.  * Mask to extract process table index from pid.
  214.  */
  215. #define    PROC_INDEX_MASK        0x000000FF
  216.  
  217. /*
  218.  * Convert a process id into a process table index.
  219.  */
  220. #define    Proc_PIDToIndex(pid) ((pid) & PROC_INDEX_MASK)
  221.  
  222. /*
  223.  * Special parameter to Proc_Migrate to evict all processes from a
  224.  * workstation.
  225.  */
  226.  
  227. #define PROC_ALL_PROCESSES    ((Proc_PID) 0)
  228.  
  229. /*
  230.  * Special family value to indicate the process isn't in a family and 
  231.  * a macro to see if the process is in a family.
  232.  */
  233.  
  234. #define PROC_NO_FAMILY    (Proc_PID) -1
  235. #define Proc_In_A_Family(familyID) ((familyID) != PROC_NO_FAMILY)
  236.  
  237.  
  238. /*
  239.  * PROC_SUPER_USER_ID is the user ID of the omnipotent super-user and 
  240.  * PROC_NO_ID is used when specifying no id to the Proc_SetIDs call.
  241.  */
  242.  
  243. #define PROC_SUPER_USER_ID      0
  244. #define PROC_NO_ID          -1
  245.  
  246. /*
  247.  * PROC_NO_INTR_PRIORITY is used to provide system processes 
  248.  *  infinitely-high priority.
  249.  */
  250.  
  251. #define PROC_MIN_PRIORITY    -2
  252. #define PROC_MAX_PRIORITY     2
  253.  
  254. #define PROC_NO_INTR_PRIORITY     2
  255. #define PROC_HIGH_PRIORITY     1
  256. #define PROC_NORMAL_PRIORITY     0
  257. #define PROC_LOW_PRIORITY    -1
  258. #define PROC_VERY_LOW_PRIORITY    -2
  259.  
  260. /*
  261.  *  Process state flags:
  262.  */
  263. typedef enum {
  264.     PROC_UNUSED,    /* The process doesn't exist yet. */
  265.     PROC_RUNNING,    /* The process is executing on a processor. */
  266.     PROC_READY,        /* The process is ready to execute. */
  267.     PROC_WAITING,    /* The process is waiting for an event to occur such
  268.              * as I/O completion or a mutex lock released. */
  269.     PROC_EXITING,    /* The process has terminated and is on the 
  270.              * exiting list. */
  271.     PROC_DEAD,        /* The process has been terminated is on the dead list*/
  272.     PROC_MIGRATED,    /* The process is running on a remote machine. */
  273.     PROC_NEW,        /* The process was just created. */
  274.     PROC_SUSPENDED    /* The process is suspended. */
  275. } Proc_State;
  276.  
  277. #endif /* _ASM */
  278.  
  279.  
  280. /*
  281.  * Process attributes flags:
  282.  *
  283.  *  PROC_KERNEL               - The process is a kernel process.
  284.  *  PROC_USER                 - The process is a user process.
  285.  *  PROC_DEBUGGED        - The process is being debugged by the system
  286.  *                  debugger.
  287.  *  PROC_DEBUG_ON_EXEC        - The process will start in debugged mode.
  288.  *  PROC_DEBUG_WAIT        - A debugger is waiting for this process to go
  289.  *                  onto the debug list.
  290.  *  PROC_SINGLE_STEP_FLAG    - The process will have the trace bit set
  291.  *                  before it runs.
  292.  *  PROC_MIG_PENDING        - The process will be migrated when it
  293.  *                  completes its next trap.
  294.  *  PROC_DONT_MIGRATE        - The process should not be migrated yet, even
  295.  *                  when it traps.
  296.  *  PROC_FOREIGN        - The process has been migrated from another
  297.  *                  workstation to this one.
  298.  *  PROC_DYING            - The process is comitting hari-kari.
  299.  *  PROC_LOCKED            - This process is locked.
  300.  *  PROC_NO_VM            - The virtual memory resources have been
  301.  *                  freed up for this user process.
  302.  *  PROC_MIGRATING        - The process is in the middle of migrating
  303.  *                  to another workstation.  This happens after
  304.  *                  PROC_MIG_PENDING is set but before the
  305.  *                  process's PROC_MIGRATION_DONE flag is 
  306.  *                  set.  Not cleared until the process 
  307.  *                  context switches to PROC_MIGRATED or (for 
  308.  *                  evictions) exits.
  309.  *  PROC_MIGRATION_DONE        - indicates successful completion of a
  310.  *                  migration trap.  Set just before resuming 
  311.  *                  the remote process.
  312.  *  PROC_ON_DEBUG_LIST        - The process is on the debug list.
  313.  *  PROC_REMOTE_EXEC_PENDING    - The process should perform an exec as part
  314.  *                  of migration.
  315.  *  PROC_MIG_ERROR        - Indicates asynchronous error before
  316.  *                  migrating process context switches.
  317.  *  PROC_EVICTING        - Indicates process is being evicted
  318.  *                  (for statistics gathering).
  319.  *  PROC_KILLING        - Indicates we're trying to kill the process
  320.  *                  but it's in the debugger.  This is a
  321.  *                  big hack to get dbx to work.
  322.  *  PROC_VFORKCHILD        - This process created with vfork
  323.  *                                and parent is still waiting.
  324.  *  PROC_VFORKPARENT        - This process is waiting for its child
  325.  *                                to exec or exit.
  326.  *  PROC_RESUME_PROCESS        - The process should ignore a pending 
  327.  *                    suspend signal.
  328.  *  PROC_PENDING_SUSPEND    - The process has gotten a suspend signal 
  329.  *                    but hasn't suspended itself yet.
  330.  */
  331.  
  332. #define PROC_KERNEL            0x000001
  333. #define PROC_USER            0x000002
  334. #define PROC_DEBUGGED            0x000004
  335. #define PROC_DEBUG_ON_EXEC        0x000008
  336. #define PROC_SINGLE_STEP_FLAG        0x000010
  337. #define PROC_DEBUG_WAIT            0x000020
  338. #define PROC_MIG_PENDING        0x000040
  339. #define PROC_DONT_MIGRATE        0x000080
  340. #define PROC_FOREIGN            0x000100
  341. #define PROC_DYING            0x000200
  342. #define PROC_LOCKED            0x000400
  343. #define PROC_NO_VM            0x000800
  344. #define PROC_MIGRATING            0x001000
  345. #define PROC_MIGRATION_DONE        0x002000
  346. #define PROC_ON_DEBUG_LIST        0x004000
  347. #define PROC_REMOTE_EXEC_PENDING    0x008000
  348. #define PROC_MIG_ERROR            0x010000
  349. #define PROC_EVICTING            0x020000
  350. #define PROC_KILLING            0x040000
  351. #define PROC_VFORKCHILD            0x080000
  352. #define PROC_VFORKPARENT        0x100000
  353. #define PROC_RESUME_PROCESS        0x200000
  354. #define PROC_PENDING_SUSPEND        0x400000
  355.  
  356. /* 
  357.  * The include's must come after the definition of Proc_State (and 
  358.  * possibly some other stuff as well).  Blech.
  359.  */
  360.  
  361. #ifndef _ASM
  362. #include <sprite.h>
  363. #include <spriteTime.h>
  364. #ifdef KERNEL
  365. #include <sigTypes.h>
  366. #include <machTypes.h>
  367. #include <user/vmTypes.h>
  368. #else
  369. #include <kernel/sigTypes.h>
  370. #include <kernel/machTypes.h>
  371. #include <vmTypes.h>
  372. #endif
  373.  
  374. #endif /* _ASM */
  375.  
  376. #ifndef _ASM
  377.  
  378.  
  379. /*
  380.  *  Resource usage summary for a process. 
  381.  *  Used by Proc_Wait and Proc_GetResUsage.
  382.  *
  383.  *   Preliminary version: more fields will be added when needed.
  384.  *
  385.  *  Note: the cpu usage fields use the Time format. In the process
  386.  *  control block, they are stored in the Timer_Ticks format.
  387.  *  They are converted to Time format by the system calls that return
  388.  *  resource usage info.
  389.  */
  390.  
  391. typedef struct {
  392.     Time kernelCpuUsage;    /* How much time has been spent in kernel mode*/
  393.     Time userCpuUsage;        /* How much time has been spent in user mode. */
  394.  
  395.     Time childKernelCpuUsage;    /* Sum of time spent in kernel mode for 
  396.                  * all terminated children. */
  397.     Time childUserCpuUsage;    /* Sum of time been spent in user mode for
  398.                  * all terminated children. */
  399.     int    numQuantumEnds;        /* number of times the process was
  400.                  * context switched due to a quantum end. */
  401.     int numWaitEvents;        /* number of times the process was
  402.                       * context switched due to its waiting for
  403.                  *  an event. */
  404. } Proc_ResUsage;
  405.  
  406. /*
  407.  *  Request values for use with Proc_Debug system call.
  408.  */
  409.  
  410. typedef enum {
  411.     PROC_GET_THIS_DEBUG,
  412.     PROC_GET_NEXT_DEBUG,
  413.     PROC_CONTINUE,
  414.     PROC_SINGLE_STEP,
  415.     PROC_GET_DBG_STATE,
  416.     PROC_SET_DBG_STATE,
  417.     PROC_READ,
  418.     PROC_WRITE,
  419.     PROC_DETACH_DEBUGGER
  420. } Proc_DebugReq;
  421.  
  422. /*
  423.  * Flags to Proc_Wait
  424.  *
  425.  *         PROC_WAIT_BLOCK    -    Block if there if are no stopped or
  426.  *                terminated processes.
  427.  *    PROC_WAIT_FOR_SUSPEND - Return status of children that are suspended.
  428.  *                If this option isn't specified and children
  429.  *                are stopped then it is as though they are
  430.  *                still running.
  431.  */
  432. #define    PROC_WAIT_BLOCK        0x1
  433. #define    PROC_WAIT_FOR_SUSPEND    0x2
  434.  
  435. #define PROC_NUM_GENERAL_REGS 16
  436.  
  437. typedef struct {
  438.     Proc_PID    processID;        /* Process ID of debuggee */
  439.     int    termReason;            /* Reason why process has died or
  440.                      * it has been detached. */
  441.     int    termStatus;            /* Exit/detach status or signal number
  442.                      * that caused the process to die. */
  443.     int    termCode;            /* The code for the signal. */
  444.     Mach_RegState regState;        /* The register state of the process. */
  445.     int    sigHoldMask;            /* Mask of signals to be held. */
  446.     int    sigPendingMask;            /* Mask of pending signals. */
  447.     int    sigActions[SIG_NUM_SIGNALS];     /* Array of the different types
  448.                        of actions for signals. */
  449.     int    sigMasks[SIG_NUM_SIGNALS];     /* Array of signal hold masks for 
  450.                        signal handlers. */
  451.     int    sigCodes[SIG_NUM_SIGNALS];     /* Array of signal handlers for 
  452.                        signals. */
  453.  
  454. } Proc_DebugState;
  455.  
  456. /*
  457.  * Structure that represents one environment variable.
  458.  */
  459.  
  460. typedef struct {
  461.     char *name;        /* Variable name. */
  462.     char *value;    /* Value for variable. */
  463. } Proc_EnvironVar;
  464.  
  465. /*
  466.  * Process information. Add new fields to the end of this structure!
  467.  */
  468. typedef struct  {
  469.     int        processor;    /* Processor number the process is running on
  470.                  * or wants to run on if the processor is
  471.                  * available.  */
  472.  
  473.     Proc_State    state;        /* Describes a process's current running state.
  474.                  * >>> See Proc_State definitions above. */ 
  475.  
  476.     int        genFlags;    /* Flags to describe a processes overall state.
  477.                  * >>> See definitions below */ 
  478.  
  479.     /*
  480.      *-----------------------------------------------------------------
  481.      *
  482.      *   Various Process Identifiers.
  483.      *    
  484.      *    Note that the user and effectiveUser ID are kept here because
  485.      *    they are used for permission checking in various places.  There
  486.      *    is also a list of group IDs which is kept in the filesystem state.
  487.      *
  488.      *-----------------------------------------------------------------
  489.      */
  490.  
  491.     Proc_PID    processID;        /* Actual process ID of this
  492.                      * process (for migrated processes
  493.                      * this is different than the PID
  494.                      * that the user sees). */
  495.     Proc_PID    parentID;        /* The process ID of the parent 
  496.                      * of this process. */
  497.     int        familyID;        /* The id of the process family that 
  498.                      * this process belongs to. */
  499.     int        userID;            /* The user id is used to check access
  500.                      * rights to files and check ability
  501.                      * to signal other processes. */
  502.     int        effectiveUserID;    /* The effective user id is used
  503.                      * for setuid access. */
  504.  
  505.     /*
  506.      *-----------------------------------------------------------------
  507.      *
  508.      *    Synchronization fields.
  509.      *
  510.      * Synchronization state includes an event the process is waiting on.
  511.      *
  512.      *-----------------------------------------------------------------
  513.      */
  514.  
  515.     int         event;         /* Event # the process is waiting for. */
  516.  
  517.     /*
  518.      *-----------------------------------------------------------------
  519.      *
  520.      *    Scheduling fields.
  521.      *
  522.      *-----------------------------------------------------------------
  523.      */
  524.  
  525.  
  526.     int      billingRate;    /* Modifies the scheduler's calculation of
  527.                  * the processes priority.  */
  528.     unsigned int recentUsage;    /* Amount of CPU time used recently */
  529.     unsigned int weightedUsage;    /* Smoothed avg. of CPU usage, weighted by
  530.                  * billing rate. */
  531.     unsigned int unweightedUsage; /* Smoothed avg. of CPU usage, not weighted by
  532.                    * billing rate. */
  533.  
  534.     /*
  535.      *-----------------------------------------------------------------
  536.      *
  537.      *    Accounting and Resource Usage fields.
  538.      *
  539.      *-----------------------------------------------------------------
  540.      */
  541.  
  542.     Time kernelCpuUsage;    /* How much time has been spent in kernel mode*/
  543.     Time userCpuUsage;        /* How much time has been spent in user mode. */
  544.  
  545.     Time childKernelCpuUsage;    /* Sum of time spent in kernel mode for 
  546.                       * all terminated children. */
  547.     Time childUserCpuUsage;    /* Sum of time spent in user mode for
  548.                       * all terminated children. */
  549.     int     numQuantumEnds;        /* number of times the process was 
  550.                       * context switched due to a quantum 
  551.                      * end. */
  552.     int        numWaitEvents;        /* number of times the process was
  553.                      * context switched due to its waiting 
  554.                      * for an event. */
  555.     unsigned int schedQuantumTicks;    /* Number of clock ticks until this 
  556.                      * process is due to be switched out. */
  557.  
  558.     /*
  559.      *-----------------------------------------------------------------
  560.      *
  561.      *   Virtual Memory fields.
  562.      *
  563.      *-----------------------------------------------------------------
  564.      */
  565.     Vm_SegmentID        vmSegments[VM_NUM_SEGMENTS];
  566.  
  567.  
  568.     /*
  569.      *-----------------------------------------------------------------
  570.      *
  571.      *    Signals
  572.      *
  573.      *-----------------------------------------------------------------
  574.      */
  575.  
  576.     int        sigHoldMask;        /* Mask of signals to be held. */
  577.     int        sigPendingMask;        /* Mask of pending signals. */
  578.                         /* Array of the different types
  579.                        of actions for signals. */
  580.     int        sigActions[SIG_NUM_SIGNALS];
  581.                         /* Array of signal hold masks for 
  582.                        signal handlers. */
  583.     /*
  584.      *---------------------------------------------------------------------
  585.      *
  586.      * Data for process migration.
  587.      *
  588.      *---------------------------------------------------------------------
  589.      */
  590.     int        peerHostID;         /* If on home node, ID of remote node.
  591.                       * If on remote node, ID of home node.
  592.                       * If not migrated, undefined. */
  593.     Proc_PID    peerProcessID;         /* If on remote note, process ID on
  594.                       * home node, and vice-versa. */
  595. } Proc_PCBInfo;
  596.  
  597. /*
  598.  * Define the maximum length of the name and value of each enviroment
  599.  * variable and the maximum size of the environment.
  600.  */
  601.  
  602. #define    PROC_MAX_ENVIRON_NAME_LENGTH    4096
  603. #define    PROC_MAX_ENVIRON_VALUE_LENGTH    4096
  604. #define    PROC_MAX_ENVIRON_SIZE        100
  605.  
  606. /*
  607.  * Define the maximum size of the first line of an interpreter file.
  608.  */
  609.  
  610. #define PROC_MAX_INTERPRET_SIZE        80
  611.  
  612. /*
  613.  * Definitions for the Proc_G/SetIntervalTimer system calls.
  614.  *
  615.  * Currently, only 1 type of timer is defined:
  616.  *  PROC_TIMER_REAL -  time between intervals is real (a.k.a wall-clock) time.
  617.  *
  618.  * The values and the structure have the same values and layout as their 
  619.  * 4.3BSD equivalents.
  620.  */
  621.  
  622. #define PROC_TIMER_REAL        0
  623. /*
  624.  * not used yet.
  625. #define PROC_TIMER_VIRTUAL    1
  626. #define PROC_TIMER_PROFILE    2
  627. */
  628.  
  629. #define PROC_MAX_TIMER        PROC_TIMER_REAL
  630.  
  631. typedef struct {
  632.     Time    interval;    /* Amount of time between timer expirations. */
  633.     Time    curValue;    /* Amount of time till the next expiration. */
  634. } Proc_TimerInterval;
  635.  
  636. /* 
  637.  * Size of the buffer containing arguments, to be passed back to users.  
  638.  */
  639.  
  640. #define PROC_PCB_ARG_LENGTH 256
  641.  
  642. /*
  643.  * The following structure is used to transfer fixed-length argument strings
  644.  * from the kernel back to user space.  A typedef simplifies later
  645.  * declarations (and may be the only way to do it?), since 
  646.  *    char *argPtr[PROC_PCB_ARG_LENGTH]
  647.  * would be an array of pointers to strings rather than an array of strings.
  648.  */
  649.  
  650. typedef struct {
  651.     char argString[PROC_PCB_ARG_LENGTH];
  652. } Proc_PCBArgString;
  653.  
  654.  
  655. /*
  656.  * Define the state of this machine w.r.t accepting migrated processes.
  657.  * A machine must always be willing to accept its own processes if they
  658.  * are migrated home.  Other than that, a host may allow migrations onto
  659.  * it under various sets of criteria, and may allow migrations away from
  660.  * it under similar sets of criteria.
  661.  *
  662.  *    PROC_MIG_IMPORT_NEVER        - never allow migrations to this host.
  663.  *    PROC_MIG_IMPORT_ROOT         - allow migrations to this host only
  664.  *                      by root.
  665.  *    PROC_MIG_IMPORT_ALL          - allow migrations by anyone.
  666.  *    PROC_MIG_IMPORT_ANYINPUT     - don't check keyboard input when
  667.  *                      determining availability.
  668.  *    PROC_MIG_IMPORT_ANYLOAD      - don't check load average when
  669.  *                      determining availability.
  670.  *    PROC_MIG_IMPORT_ALWAYS      - don't check either.
  671.  *    PROC_MIG_EXPORT_NEVER        - never export migrations from this
  672.  *                       host.
  673.  *    PROC_MIG_EXPORT_ROOT            - allow only root to export.
  674.  *    PROC_MIG_EXPORT_ALL            - allow anyone to export.
  675.  *
  676.  * For example, a reasonable default for a file server might be to import
  677.  * and export only for root; for a user's machine, it might be to allow
  678.  * anyone to migrate; and for a compute server, it might never export
  679.  * and import always regardless of load average or keyboard input.  (The
  680.  * load average would not have to be exceptionally low to determine
  681.  * availability; the host still would only be selected if the load average
  682.  * were low enough to gain something by migrating to it.)
  683.  */
  684.  
  685. #define PROC_MIG_IMPORT_NEVER              0
  686. #define PROC_MIG_IMPORT_ROOT        0x00000001
  687. #define PROC_MIG_IMPORT_ALL         0x00000003
  688. #define PROC_MIG_IMPORT_ANYINPUT    0x00000010
  689. #define PROC_MIG_IMPORT_ANYLOAD        0x00000020
  690. #define PROC_MIG_IMPORT_ALWAYS  \
  691.             (PROC_MIG_IMPORT_ANYINPUT | PROC_MIG_IMPORT_ANYLOAD)
  692. #define PROC_MIG_EXPORT_NEVER             0
  693. #define PROC_MIG_EXPORT_ROOT        0x00010000
  694. #define PROC_MIG_EXPORT_ALL        0x00030000
  695.  
  696. #define PROC_MIG_ALLOW_DEFAULT (PROC_MIG_IMPORT_ALL | PROC_MIG_EXPORT_ALL)
  697.  
  698. /*
  699.  * Library call declarations.
  700.  */
  701.  
  702. extern ReturnStatus Proc_SetExitHandler();
  703. extern void        Proc_Exit();
  704.  
  705. /*
  706.  * System call declarations.
  707.  */
  708.  
  709. extern ReturnStatus Proc_Fork();
  710. extern void        Proc_RawExit();
  711. extern ReturnStatus Proc_Detach();
  712. extern ReturnStatus Proc_Wait();
  713. extern ReturnStatus Proc_RawWait();
  714. extern ReturnStatus Proc_Exec();
  715. extern ReturnStatus Proc_ExecEnv();
  716.  
  717. extern ReturnStatus Proc_GetIDs();
  718. extern ReturnStatus Proc_SetIDs();
  719. extern ReturnStatus Proc_GetGroupIDs();
  720. extern ReturnStatus Proc_SetGroupIDs();
  721. extern ReturnStatus Proc_GetFamilyID();
  722. extern ReturnStatus Proc_SetFamilyID();
  723.  
  724. extern ReturnStatus Proc_GetPCBInfo();
  725. extern ReturnStatus Proc_GetResUsage();
  726. extern ReturnStatus Proc_GetPriority();
  727. extern ReturnStatus Proc_SetPriority();
  728.  
  729. extern ReturnStatus Proc_Debug();
  730. extern ReturnStatus Proc_Profile();
  731.  
  732. extern ReturnStatus Proc_SetIntervalTimer();
  733. extern ReturnStatus Proc_GetIntervalTimer();
  734.  
  735. extern ReturnStatus Proc_SetEnviron();
  736. extern ReturnStatus Proc_UnsetEnviron();
  737. extern ReturnStatus Proc_GetEnvironVar();
  738. extern ReturnStatus Proc_GetEnvironRange();
  739. extern ReturnStatus Proc_InstallEnviron();
  740. extern ReturnStatus Proc_CopyEnviron();
  741.  
  742. extern ReturnStatus Proc_Migrate();
  743.  
  744. #endif /* _ASM */
  745.  
  746. #endif /* _PROCUSER */
  747. @
  748.  
  749.  
  750. 1.21
  751. log
  752. @Add PROC_RESUME_PROCESS and PROC_PENDING_SUSPEND flags.
  753. @
  754. text
  755. @d15 1
  756. a15 1
  757.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.20 91/08/24 13:05:37 mottsmth Exp Locker: kupfer $ SPRITE (Berkeley)
  758. d172 4
  759. a175 2
  760.  *                  process's state becomes PROC_MIGRATED and
  761.  *                  its PROC_MIGRATION_DONE flag is set.
  762. d177 2
  763. a178 1
  764.  *                  migration trap.
  765. @
  766.  
  767.  
  768. 1.20
  769. log
  770. @Need two flags for vfork
  771. @
  772. text
  773. @d15 1
  774. a15 1
  775.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.19 91/08/20 13:03:20 mottsmth Exp Locker: mottsmth $ SPRITE (Berkeley)
  776. d190 4
  777. d195 24
  778. a218 22
  779.  
  780. #define PROC_KERNEL            0x00001
  781. #define PROC_USER            0x00002
  782. #define PROC_DEBUGGED            0x00004
  783. #define PROC_DEBUG_ON_EXEC        0x00008
  784. #define PROC_SINGLE_STEP_FLAG        0x00010
  785. #define PROC_DEBUG_WAIT            0x00020
  786. #define PROC_MIG_PENDING        0x00040
  787. #define PROC_DONT_MIGRATE        0x00080
  788. #define PROC_FOREIGN            0x00100
  789. #define PROC_DYING            0x00200
  790. #define PROC_LOCKED            0x00400
  791. #define PROC_NO_VM            0x00800
  792. #define PROC_MIGRATING            0x01000
  793. #define PROC_MIGRATION_DONE        0x02000
  794. #define PROC_ON_DEBUG_LIST        0x04000
  795. #define PROC_REMOTE_EXEC_PENDING    0x08000
  796. #define PROC_MIG_ERROR            0x10000
  797. #define PROC_EVICTING            0x20000
  798. #define PROC_KILLING            0x40000
  799. #define PROC_VFORKCHILD            0x80000
  800. #define PROC_VFORKPARENT           0x100000
  801. @
  802.  
  803.  
  804. 1.19
  805. log
  806. @Add vfork flag
  807. @
  808. text
  809. @d15 1
  810. a15 1
  811.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.18 91/05/17 17:30:23 kupfer Exp Locker: mottsmth $ SPRITE (Berkeley)
  812. d186 1
  813. a186 1
  814.  *  PROC_VFORK            - This process created with vfork
  815. d188 2
  816. d211 2
  817. a212 1
  818. #define PROC_VFORK            0x80000
  819. @
  820.  
  821.  
  822. 1.18
  823. log
  824. @Make sure macro definitions put parentheses around their arguments.
  825. @
  826. text
  827. @d15 1
  828. a15 1
  829.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.17 91/03/17 23:28:09 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  830. d186 2
  831. d209 1
  832. @
  833.  
  834.  
  835. 1.18.1.1
  836. log
  837. @Branch for Sprite server changes.
  838. @
  839. text
  840. @d15 1
  841. a15 1
  842.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.18 91/05/17 17:30:23 kupfer Exp $ SPRITE (Berkeley)
  843. @
  844.  
  845.  
  846. 1.17
  847. log
  848. @Include <sprite.h> (for ReturnStatus).
  849. @
  850. text
  851. @d15 1
  852. a15 1
  853.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.16 91/03/01 22:11:03 kupfer Exp Locker: kupfer $ SPRITE (Berkeley)
  854. d87 1
  855. a87 1
  856. #define    Proc_PIDToIndex(pid) (pid & PROC_INDEX_MASK)
  857. d102 1
  858. a102 1
  859. #define Proc_In_A_Family(familyID) (familyID != PROC_NO_FAMILY)
  860. @
  861.  
  862.  
  863. 1.16
  864. log
  865. @VM types split out into vmTypes.h
  866. @
  867. text
  868. @d15 1
  869. a15 1
  870.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.15 90/11/14 13:23:55 shirriff Exp Locker: kupfer $ SPRITE (Berkeley)
  871. d208 5
  872. d214 1
  873. @
  874.  
  875.  
  876. 1.15
  877. log
  878. @Increased max environment variable length for compat. with sunOS.
  879. @
  880. text
  881. @d15 1
  882. a15 1
  883.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.14 90/10/19 15:50:38 jhh Exp Locker: shirriff $ SPRITE (Berkeley)
  884. d213 1
  885. a213 1
  886. #include <user/vm.h>
  887. d217 1
  888. a217 1
  889. #include <vm.h>
  890. @
  891.  
  892.  
  893. 1.14
  894. log
  895. @needed to include a few more files.
  896. @
  897. text
  898. @d15 1
  899. a15 1
  900.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.13 90/06/21 13:56:30 shirriff Exp Locker: mendel $ SPRITE (Berkeley)
  901. d448 2
  902. a449 2
  903. #define    PROC_MAX_ENVIRON_NAME_LENGTH    512
  904. #define    PROC_MAX_ENVIRON_VALUE_LENGTH    512
  905. @
  906.  
  907.  
  908. 1.13
  909. log
  910. @Added PROC_KILLING to make dbx work.
  911. @
  912. text
  913. @d15 1
  914. a15 1
  915.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.12 89/10/12 12:14:40 jhh Exp Locker: shirriff $ SPRITE (Berkeley)
  916. a20 12
  917. #ifndef _ASM
  918.  
  919. #include <spriteTime.h>
  920. #include <sig.h>
  921. #include <kernel/mach.h>
  922. #ifdef KERNEL
  923. #include <user/vm.h>
  924. #else
  925. #include <vm.h>
  926. #endif
  927.  
  928. #endif /* _ASM */
  929. d70 1
  930. d208 13
  931. @
  932.  
  933.  
  934. 1.12
  935. log
  936. @spelled dying correctly
  937. @
  938. text
  939. @d15 1
  940. a15 1
  941.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.11 89/10/10 16:04:02 douglis Exp Locker: jhh $ SPRITE (Berkeley)
  942. d194 3
  943. d217 1
  944. @
  945.  
  946.  
  947. 1.11
  948. log
  949. @added PROC_EVICTING flag for statistics gathering purposes.
  950. @
  951. text
  952. @d15 1
  953. a15 1
  954.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.10 89/09/08 16:27:22 mgbaker Exp Locker: douglis $ SPRITE (Berkeley)
  955. d176 1
  956. a176 1
  957.  *  PROC_DIEING            - The process is comitting hari-kari.
  958. d205 1
  959. a205 1
  960. #define PROC_DIEING            0x00200
  961. @
  962.  
  963.  
  964. 1.10
  965. log
  966. @Adding more _ASM stuff.
  967. @
  968. text
  969. @d15 1
  970. a15 1
  971.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.9 89/08/08 11:09:30 douglis Exp Locker: mgbaker $ SPRITE (Berkeley)
  972. d187 1
  973. a187 1
  974.  *  PROC_ON_DEBUG_LIST        - the process is on the debug list.
  975. d190 1
  976. a190 1
  977.  *  PROC_MIG_ERROR        - indicates asynchronous error before
  978. d192 2
  979. d213 1
  980. @
  981.  
  982.  
  983. 1.9
  984. log
  985. @added PROC_MIG_ERROR flag
  986. @
  987. text
  988. @d15 1
  989. a15 1
  990.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.8 89/07/05 21:09:35 rab Exp Locker: douglis $ SPRITE (Berkeley)
  991. d21 2
  992. d32 2
  993. d74 1
  994. d154 3
  995. d213 2
  996. d580 2
  997. @
  998.  
  999.  
  1000. 1.8
  1001. log
  1002. @*** empty log message ***
  1003. @
  1004. text
  1005. @d15 1
  1006. a15 1
  1007.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.7 89/06/23 11:29:53 rab Exp Locker: rab $ SPRITE (Berkeley)
  1008. d182 2
  1009. d202 1
  1010. @
  1011.  
  1012.  
  1013. 1.7
  1014. log
  1015. @*** empty log message ***
  1016. @
  1017. text
  1018. @d15 1
  1019. a15 1
  1020.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.6 89/06/15 22:34:13 douglis Exp Locker: rab $ SPRITE (Berkeley)
  1021. d243 1
  1022. a243 1
  1023.     PROC_DETACH_DEBUGGER,
  1024. @
  1025.  
  1026.  
  1027. 1.6
  1028. log
  1029. @added PROC_REMOTE_EXEC_PENDING flag.
  1030. @
  1031. text
  1032. @d15 1
  1033. a15 1
  1034.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.5 89/04/07 10:31:25 douglis Exp Locker: douglis $ SPRITE (Berkeley)
  1035. d568 1
  1036. a568 1
  1037. #endif _PROCUSER
  1038. @
  1039.  
  1040.  
  1041. 1.5
  1042. log
  1043. @moved PROC_MIG_{IM,EX}PORT_* definitions here.
  1044. @
  1045. text
  1046. @d15 1
  1047. a15 1
  1048.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.4 89/03/27 22:26:01 jhh Exp Locker: douglis $ SPRITE (Berkeley)
  1049. d180 2
  1050. d199 1
  1051. d414 5
  1052. a418 6
  1053.     int            peerHostID;    /* If on home node, ID of remote node.
  1054.                      * If on remote node, ID of home node.
  1055.                      * If not migrated, undefined. */
  1056.     Proc_PID        peerProcessID;     /* If on remote note, process ID on
  1057.                      * home node, and vice-versa. */
  1058.  
  1059. @
  1060.  
  1061.  
  1062. 1.4
  1063. log
  1064. @moved all the stuff needed for the new interface to Proc_GetPCBInfo out
  1065. of kernel include file
  1066. @
  1067. text
  1068. @d15 1
  1069. a15 1
  1070.  * $Header: /sprite/src/lib/include/RCS/proc.h,v 1.3 88/08/25 12:24:17 nelson Exp Locker: jhh $ SPRITE (Berkeley)
  1071. d476 43
  1072. @
  1073.  
  1074.  
  1075. 1.3
  1076. log
  1077. @Changed to use the Mach_RegState struct.
  1078. @
  1079. text
  1080. @d15 1
  1081. a15 1
  1082.  * $Header: proc.h,v 1.2 88/06/21 16:38:32 ouster Exp $ SPRITE (Berkeley)
  1083. d24 5
  1084. d86 10
  1085. d133 65
  1086. d199 1
  1087. d287 133
  1088. d457 18
  1089. @
  1090.  
  1091.  
  1092. 1.2
  1093. log
  1094. @Use "spriteTime.h" instead of "time.h" to avoid conflict with UNIX.
  1095. @
  1096. text
  1097. @d15 1
  1098. a15 1
  1099.  * $Header: proc.h,v 1.1 88/06/21 09:36:54 ouster Exp $ SPRITE (Berkeley)
  1100. d23 1
  1101. a24 1
  1102.  
  1103. d184 1
  1104. a184 6
  1105.     int    genRegs[PROC_NUM_GENERAL_REGS];    /* All of the general purpose 
  1106.                      * registers.  */
  1107.     int    progCounter;            /* The program counter when the 
  1108.                        system call occured. */
  1109.     int    statusReg;            /* The status register when the 
  1110.                        system call occured. */
  1111. @
  1112.  
  1113.  
  1114. 1.1
  1115. log
  1116. @Initial revision
  1117. @
  1118. text
  1119. @d15 1
  1120. a15 1
  1121.  * $Header: proc.h,v 2.5 88/05/26 11:05:36 ouster Exp $ SPRITE (Berkeley)
  1122. d21 2
  1123. a22 2
  1124. #include "time.h"
  1125. #include "sig.h"
  1126. @
  1127.